﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DB.Model;

namespace HR_ASP.ViewModel
{
    public class PracowBadanView
    {
        public int ID { get; set; }
        public int IDBad { get; set; }
        public int IDPrac { get; set; }
        public string NazwaBadania { get; set; }
        public bool CzyZaznaczone { get; set; }
        public DateTime? DataWaznosci { get; set; }
        public DateTime? DataOstatnBadania { get; set; }
        public DateTime? DataU { get; set; }
        public DateTime? DataM { get; set; }


        public PracowBadanView()
        {
        }

        public PracowBadanView(Pracow_Badan pb)
        {
            this.ID = pb.ID_PB;
            this.IDBad = (int)pb.ID_Bad;
            this.IDPrac = (int)pb.ID_Pracow;
            this.DataWaznosci = (DateTime)pb.Data_Wazn;
            this.DataOstatnBadania = (DateTime)pb.Data_Ostatn_Badan;
            this.DataU = pb.DataU;
            this.DataM = pb.DataM;
        }

        public Pracow_Badan getModelDB(Pracow_Badan pracBad)
        {
            pracBad.ID_Bad = this.IDBad;
            pracBad.ID_Pracow = this.IDPrac;
            pracBad.Data_Ostatn_Badan = this.DataOstatnBadania;
            pracBad.Data_Wazn = this.DataWaznosci;
            if (this.ID == 0)
            {
                pracBad.DataU = DateTime.Now;
            }
            pracBad.DataM = DateTime.Now;
            return pracBad;
        }

    }
}